<?php
/*
	Copyright (C) 2008 - 2012 Inanta Martsanto
	Inanta Martsanto (inanta@inationsoft.com)

	This file is part of NewStep Framework.

	NewStep Framework is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	NewStep Framework is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with NewStep Framework.  If not, see <http://www.gnu.org/licenses/>.
*/

namespace Inationsoft\NS\Template\Engine;

include_once(KOMA_SMARTY_PATH.'/Smarty.class.php');

/**
 *Smarty templating engine
 *
 *@author Inanta Martsanto <inanta@inationsoft.com>
 */
final class SmartyTemplate extends Object {
        function __construct() {
                $this->createProperties(array('File' => '', 'Engine' => new \Smarty()));
                $this->setReadOnlyProperties(array('Engine'));
                
		$this->Engine->setTemplateDir(KOMA_THEME_PATH . '/' . KOMA_THEME);
		$this->Engine->setCacheDir(KOMA_CACHE_PATH);
		$this->Engine->setCompileDir(KOMA_COMPILE_PATH);
        }
        
        function display($resource_name, $cache_id = null, $compile_id = null) {
                $this->Engine->display($resource_name, $cache_id, $compile_id);
        }
        
        function fetch($resource_name, $cache_id = null, $compile_id = null) {
                return $this->Engine->fetch($resource_name, $cache_id, $compile_id);
        }
        
        function assign($tpl_var, $value = null) {
                $this->Engine->assign($tpl_var, $value);
        }
        
        function append($tpl_var, $value=null, $merge=false) {
                $this->Engine->append($tpl_var, $value, $merge);
        }
        
        function clearAssign($tpl_var) {
                $this->Engine->clear_assign($tpl_var);
        }
        
        function clearAllAssign() {
                $this->Engine->clearAllAssign();
        }
}
?>
